--- bin/Makefile	2013-11-19 00:23:37.000000000 -0500
+++ bin/Makefile.xfoil	2016-09-12 22:42:05.000000000 -0400
@@ -4,10 +4,7 @@
 # M.Drela
 #*********************************************************
 
-
-SHELL = sh
-BINDIR = /home/codes/bin/
-#BINDIR = .
+BINDIR = $(DESTDIR)/usr/bin
 
 PROGS = xfoil pplot pxplot
 
@@ -33,104 +30,39 @@
 OSOBJ = frplot.o ntcalc.o osmap.o getosfile.o
 
 ##----------------------------------------------------
-PLTOBJ = ../plotlib/libPlt.a 
+PLTOBJ = ../plotlib/libPlt_gDP.a 
 
 # Use this if you have a copy of the plotlib as a system library
 #PLTOBJ = -lPlt 
 
 # The extra location arg here is for Linux which places X libs in /usr/X11R6
-PLTLIB = -L/usr/X11R6/lib -lX11
+PLTLIB = -lX11
 
 ###================================================
 ###  Default compilers and flags
 ###  FFLOPT used for xsolve.f
-FC = f77
-FFLAGS  = -O 
-FFLOPT  = -O
-INSTALLCMD = install -s
-
-CC = cc
-CFLAGS = -O -DUNDERSCORE
-
-##--------------------------
 
-# Uncomment flags for desired machine...
+CC = gcc
+CFLAGS = -O2 -DUNDERSCORE
 
 ##--------------------------
-### DEC Alpha with OSF and DEC f77/f90 compiler
-#FC = f77
-#FFLAGS = -fast -O4 -tune host
-#FFLOPT = -fast -O4 -tune host
-#FFLOPT = -fast -O5 -tune host -unroll 3
-# Debug flags
-#FFLAGS = -O0 -g
-#FFLOPT = -fast -O4 -tune host
-##--------------------------
-### SGI setup
-#FC = f77
-#FFLAGS = -O2 -static
-#FFLOPT = -O2 -static
-##--------------------------
-##  Uncomment for RS/6000
-#FFLAGS = -O -qextname
-#FFLOPT = -O -qextname
-##--------------------------
-##  Uncomment for HP-9000
-#FFLAGS = -O +ppu
-#FFLOPT = -O +ppu
-#FTNLIB = -U77
-##--------------------------
-### Absoft Linux f77
-#FC = f77
-#FFLAGS = -O -f -s -W -B108 -N34
-#FFLOPT = -O -f -s -W -B108 -N34
-##--------------------------
-### f2c/gcc compiler driver 
-#FC = fort77
-#FFLAGS = -O2 -fomit-frame-pointer
-#FFLOPT = -O2 -fomit-frame-pointer
-##--------------------------
-### GNU g77
-#FC = g77
-#FFLAGS = -O3 -fomit-frame-pointer
-#FFLOPT = -O3 -fomit-frame-pointer
-# Debug flags (symbols, array bounds)
-#FC = g77
-#FFLAGS = -g -O0 -C
-##--------------------------
-### GNU gfortran
-#FC = gfortran
-#FFLAGS = -O3 -fomit-frame-pointer
-#FFLOPT = -O3 -fomit-frame-pointer
-# Debug flags (symbols, array bounds)
-#FFLAGS = -g -O0 -fbounds-check
-#FFLOPT = -g -O0 -fbounds-check
-#
-### Double precision option
-#FFLAGS = -O3 -fdefault-real-8
-#FFLOPT = -O3 -fdefault-real-8
-#FFLAGS = -O3 -fdefault-real-8 -fbounds-check
-#FFLOPT = -O3 -fdefault-real-8 -fbounds-check
-# Debug flags (symbols, array bounds)
-#FFLAGS = -g -O0 -C
-##--------------------------
 ### Gfortran
 FC = gfortran
 CHK = 
-CHK = -fbounds-check -finit-real=inf -ffpe-trap=invalid,zero
+CHK = -std=legacy
 DBL = -fdefault-real-8
-FFLAGS = -O $(CHK) $(DBL)
-FFLOPT = -O $(CHK) $(DBL)
+FFLAGS = -O2 $(CHK) $(DBL)
+FFLOPT = -O2 $(CHK) $(DBL)
 FTNLIB =
 
 PLTOBJ = ../plotlib/libPlt_gDP.a 
 
 
-
 all:	 $(PROGS)
 
 install: 
-	$(INSTALLCMD) $(PROGS) $(BINDIR)
+	install -d -m 0755 $(BINDIR)
+	install -m 0755 $(PROGS) $(BINDIR)
 
 clean:
 	-/bin/rm $(PROGS)
@@ -141,20 +73,15 @@
 
 xfoil: $(XFOILOBJ) $(XUTILOBJ) $(OSOBJ)
 	$(FC) -o xfoil $(XFOILOBJ) $(XUTILOBJ) $(OSOBJ) $(PLTOBJ) $(PLTLIB) $(FTNLIB)
-	$(INSTALLCMD) xfoil $(BINDIR)
 
 pxplot:	$(PXPLOTOBJ) $(XUTILOBJ)
 	$(FC) -o pxplot $(PXPLOTOBJ) $(XUTILOBJ) $(PLTOBJ) $(PLTLIB) $(FTNLIB)
-	$(INSTALLCMD) pxplot $(BINDIR)
 
 pplot:	$(PPLOTOBJ) $(XUTILOBJ)
 	$(FC) -o pplot $(PPLOTOBJ) $(XUTILOBJ)  $(PLTOBJ) $(PLTLIB) $(FTNLIB)
-	$(INSTALLCMD) pplot $(BINDIR)
 
 blu: blu.o profil.o
 	$(FC) -o blu blu.o profil.o
-	$(INSTALLCMD) blu $(BINDIR)
-
 
 blu.o: $(SRC)/blu.f
 	$(FC) -c $(FFLAGS) $(SRC)/blu.f
